import request from '@/utils/request'

// 生成订单
export function addOrders (data) {
  return request({
    url: '/v1/orders',
    method: 'post',
    data
  })
}

// 我的订单
export function getOrders (data) {
  return request({
    url: '/v1/orders',
    method: 'get',
    data
  })
}

// 取消订单
export function closeOrder (order) {
  return request({
    url: `/v1/orders/${order}/closed`,
    method: 'post'
  })
}

// 订单详情
export function orderDetail (order) {
  return request({
    url: `/v1/orders/${order}`,
    method: 'get'
  })
}

// 订单微信二维码
export function orderPayWechat (order) {
  return request({
    url: `/v1/payment/${order}/wechat`,
    method: 'get'
  })
}

// 支付订单二维码
export function orderPayAlipay (order) {
  return request({
    url: `/v1/payment/${order}/alipay`,
    method: 'get'
  })
}
// 订单线下汇款
export function offLinePay (order) {
  return request({
    url: `/v1/payment/${order}/wechat`,
    method: 'get'
  })
}

// 上传线下汇款截图
export function uploadPayImg (data, id) {
  return request({
    url: `/v1/payment/${id}/offline_pay`,
    method: 'post',
    data
  })
}
// 合同
export function getcontract (order) {
  return request({
    url: `/v1/orders/${order}/contract`,
    method: 'get'
  })
}

// 物流信息
export function getLogisticsData (order) {
  return request({
    url: `/v1/orders/${order}/expresses`,
    method: 'post'
  })
}

// 确认收货
export function confirmGoods(id){
  return request({
    url:`/v1/orders/${id}/received`,
    method:'post'
  })
}
